package com.wzh.service;

import com.wzh.dao.RoleDao;
import com.wzh.dao.RouterDao;
import com.wzh.pojo.Po.Notes;
import com.wzh.pojo.Po.RoleType;
import com.wzh.pojo.Resp.DataResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleService {
	@Autowired
	private RoleDao roleDao;
	public DataResp<Object> show() {
		DataResp<Object> resp=new DataResp<>();
		List<RoleType> RoleTypes= roleDao.show();
		resp.setData(RoleTypes);
		return  resp;
	}

	public DataResp<Object> add(Integer id, Integer[] tid) {
		DataResp<Object> resp=new DataResp<>();
			Integer res =roleDao.DelRole(id);
				Integer code =roleDao.addRole(id,tid);
				if (code>0){
					resp.setMes("操作成功！");
				}else{
					resp.setMes("没发生任何变化！");
				}
		return  resp;
	}
}
